//
// Created by v on 24-5-13.
//

#ifndef JKLIBS_CM_BROADCAST_FUNCTION_H
#define JKLIBS_CM_BROADCAST_FUNCTION_H

#include <iostream>
#include "CMMsgTaskManager.h"
#include "CMTimeout.h"
#include "net/connect/cm_broadcast.h"

class CMBroadcastFunction : public CMTimeout
{
  public:
    CMBroadcastFunction();
    virtual ~CMBroadcastFunction();

    int start(int port, bool recv=false);
    int stop();

    int sendBroadcast(std::string &data);
    int recvBroadcast(std::string &data);

    std::string getName()
    {
        return name;
    }

  private:
    CMBroadcastHandle broadcastHandle;
    std::string name;
};

#endif // JKLIBS_CM_BROADCAST_FUNCTION_H
